#ifndef EDITOR_H
#define EDITOR_H
#include <Qsci/qsciscintilla.h>
#include <Qsci/qscilexercpp.h>
#include <QFrame>

/*!

BlackRabbit - OpenSource IDE.
@author Edward Sarkisyan (edward.sarkisyan@gmail.com)
Use LGPL (http://www.gnu.org/copyleft/lesser.html)

*/



class QsciLexerCPP;

class Editor : public QsciScintilla
{
    /*!
      @class Editor
      @brief Provides source editor widget
      @author Edward Sarkisyan
      */

public:
    /*!
      @sa Editor(QWidget *parent = 0)
      @brief Constructor
      @arg parent widget
      */
    Editor(QWidget *parent=0);
    /*!
      void setupDefaults()
      @brief Setting default params
      */
    void setupDefaults();
    void setupDefaultLexer();
    void setFilePath(QString);
    QString filePath();
    void setCurrentFile(const QString&);
    void setFont(const QFont &f);
    void maybeSave();
public slots:
    /*!
      @sa bool save();
      #return Returns was saving successeful
      @brief save editor content
      */
    bool save();
    /*!
      @sa bool saveAs();
      @return Returns was saving successeful
      @brief save editor content as not standart file format
      */
    bool saveAs();
private:

    /*!
      @sa bool saveFile(QString fileName)
      @arg fileName save current content in this file
      */
    bool saveFile(QString fileName);
    QString m_openedFilePath;
    QsciLexerCPP *lexer;
};

#endif // EDITOR_H
